# Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
# Contributor : bartus <arch-user-repoᘓbartus.33mail.com>
_name=UncertaintyTE
pkgname=uncertainty-framework
pkgver=1.2.0
pkgrel=5
pkgdesc="Uncertainty estimation framework for a surface from motion dataset"
arch=('loong64' 'x86_64')
url="http://alicevision.github.io/"
license=('MPL2')
depends=('magma' 'ceres-solver')
makedepends=('boost' 'cmake' 'ninja' 'git' 'gflags' 'cuda' 'pcre')
source=("${_name}::git+https://github.com/alicevision/${_name}.git#commit=d995765"
        "ctest.patch")
sha256sums=('SKIP'
            'abf50924a78ec9628212c5b7086592d302155cf50dcc6f4c49a92d57b9a3b020')

prepare() {
  cd ${srcdir}/${_name}
  git apply -v ${srcdir}/ctest.patch
}

pkgver() {
  grep -oP "VERSION \K.*(?=\))" <(pcregrep -Mo -e '(?s)^PROJECT.*?\)' ${srcdir}/${_name}/CMakeLists.txt)
}

build() {
  cd ${_name}
  cmake \
    -Bbuild \
    -GNinja \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_BUILD_TYPE=None \
    -DMAGMA_ROOT=/usr \
    -DUNC_BUILD_TESTS=ON \
    -DUNC_MKL_SUPPORT=ON
  ninja -C build
}


package() {
  cd ${_name}
  DESTDIR=${pkgdir} ninja -C build install
}

check() {
  cd ${_name}/build/src
  ctest
}

# vim:set sw=2 ts=2 et:
